Xbasic

rsToJSON Function

Syntax

C Result = rsToJSON(rs as SQL::ResultSet [,startRow as N [,rows as N [,flagForceObjectNamesToUppercase as L [,forceToChar as L [,dateTimeFormat as C [,dateFormat as C]]]]]])

Arguments

rsSQL::ResultSet

ResultSet

startRowNumeric

(optional) first row to use

rowsNumeric

(optional) number of rows to use

flagForceObjectNamesToUppercaseLogical

(optional) Uppercase names if .T.

forceToCharLogical

(optional) If .T. (default) single-quote numeric and logical values

dateTimeFormatCharacter

(optional) Format string for dateTime values, as used by the time Function, e.g. "yyyy-MM-dd"

dateFormatCharacter

(optional) Format string for date values, as used by the time Function

Description

Takes an AlphaDAO resultset and converts the data to a JSON object.

Example

dim cn as sql::connection
cn.Open("::Name::Northwind")
cn.Execute("select * from orders")
rs=cn.ResultSet
txt=rsToJSON(rs, -1, 10)
showvar(txt)

See Also